<?php

spl_autoload_register(function ($class_name) {

    $class_maps = [
        'element_dao' => 'dao/element.php',
        'element_instance_dao' => 'dao/element_instance.php',
        'engine_log_dao' => 'dao/engine_log.php',
        'engine_rule_dao' => 'dao/engine_rule.php',
        'event_dao' => 'dao/event.php',
        'event_instance_dao' => 'dao/event_instance.php',
        'field_dao' => 'dao/field.php',
        'field_instance_dao' => 'dao/field_instance.php',
        'group_dao' => 'dao/group.php',
        'rule_relation_dao' => 'dao/rule_relation.php',
        'subject_dao' => 'dao/subject.php',
        'subject_instance_dao' => 'dao/subject_instance.php',
        'tag_dao' => 'dao/tag.php',
        'tag_target_dao' => 'dao/tag_target.php',
        'element' => 'entity/element.php',
        'element_instance' => 'entity/element_instance.php',
        'engine_log' => 'entity/engine_log.php',
        'engine_rule' => 'entity/engine_rule.php',
        'event' => 'entity/event.php',
        'event_instance' => 'entity/event_instance.php',
        'field' => 'entity/field.php',
        'field_instance' => 'entity/field_instance.php',
        'group' => 'entity/group.php',
        'rule_relation' => 'entity/rule_relation.php',
        'subject' => 'entity/subject.php',
        'subject_instance' => 'entity/subject_instance.php',
        'tag' => 'entity/tag.php',
        'tag_target' => 'entity/tag_target.php',
    ];

    if (isset($class_maps[$class_name])) {
        include __DIR__.'/'.$class_maps[$class_name];
    }
});
